package com.bt7274.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * BitTorrent对等体信息表
 * </p>
 *
 * @author hp
 * @since 2025-06-01
 */
public class Peer implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键ID，唯一标识每个对等体记录
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 对等体的IP地址，用于网络通信
     */
    private String ip;

    /**
     * 对等体监听的端口号，用于建立连接
     */
    private Integer port;

    /**
     * 种子/资源的哈希值，用于唯一标识一个资源内容
     */
    private String infoHash;

    /**
     * 对等体的唯一标识符，由客户端生成
     */
    private String peerId;

    /**
     * 客户端用户代理信息，标识使用的BT客户端类型
     */
    private String userAgent;

    /**
     * 已上传的数据总量（字节）
     */
    private Long uploaded;

    /**
     * 已下载的数据总量（字节）
     */
    private Long downloaded;

    /**
     * 剩余需要下载的数据量（字节），默认为0表示已完成下载
     */
    private Long leftByte;

    /**
     * 标识该对等体是否为播种者（已完成下载并继续上传），true/false
     */
    private Boolean seeder;

    /**
     * 标识该对等体是否为部分播种者（只上传了部分内容），true/false
     */
    private Boolean partialSeeder;

    /**
     * 访问资源的密钥或令牌，用于授权访问
     */
    private String passkey;

    /**
     * 记录最后更新时间的时间戳
     */
    private LocalDateTime updateAt;

    /**
     * 已上传的总时间（秒）
     */
    private Long seedingTime;

    /**
     * 当前上传速度（字节/秒）
     */
    private Long uploadSpeed;

    /**
     * 当前下载速度（字节/秒）
     */
    private Long downloadSpeed;

    /**
     * 关联的用户ID，外键关联到用户表
     */
    private String userId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getInfoHash() {
        return infoHash;
    }

    public void setInfoHash(String infoHash) {
        this.infoHash = infoHash;
    }

    public String getPeerId() {
        return peerId;
    }

    public void setPeerId(String peerId) {
        this.peerId = peerId;
    }

    public String getUserAgent() {
        return userAgent;
    }

    public void setUserAgent(String userAgent) {
        this.userAgent = userAgent;
    }

    public Long getUploaded() {
        return uploaded;
    }

    public void setUploaded(Long uploaded) {
        this.uploaded = uploaded;
    }

    public Long getDownloaded() {
        return downloaded;
    }

    public void setDownloaded(Long downloaded) {
        this.downloaded = downloaded;
    }

    public Long getLeftByte() {
        return leftByte;
    }

    public void setLeftByte(Long leftByte) {
        this.leftByte = leftByte;
    }

    public Boolean getSeeder() {
        return seeder;
    }

    public void setSeeder(Boolean seeder) {
        this.seeder = seeder;
    }

    public Boolean getPartialSeeder() {
        return partialSeeder;
    }

    public void setPartialSeeder(Boolean partialSeeder) {
        this.partialSeeder = partialSeeder;
    }

    public String getPasskey() {
        return passkey;
    }

    public void setPasskey(String passkey) {
        this.passkey = passkey;
    }

    public LocalDateTime getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(LocalDateTime updateAt) {
        this.updateAt = updateAt;
    }

    public Long getSeedingTime() {
        return seedingTime;
    }

    public void setSeedingTime(Long seedingTime) {
        this.seedingTime = seedingTime;
    }

    public Long getUploadSpeed() {
        return uploadSpeed;
    }

    public void setUploadSpeed(Long uploadSpeed) {
        this.uploadSpeed = uploadSpeed;
    }

    public Long getDownloadSpeed() {
        return downloadSpeed;
    }

    public void setDownloadSpeed(Long downloadSpeed) {
        this.downloadSpeed = downloadSpeed;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "Peer{" +
                "id = " + id +
                ", ip = " + ip +
                ", port = " + port +
                ", infoHash = " + infoHash +
                ", peerId = " + peerId +
                ", userAgent = " + userAgent +
                ", uploaded = " + uploaded +
                ", downloaded = " + downloaded +
                ", leftByte = " + leftByte +
                ", seeder = " + seeder +
                ", partialSeeder = " + partialSeeder +
                ", passkey = " + passkey +
                ", updateAt = " + updateAt +
                ", seedingTime = " + seedingTime +
                ", uploadSpeed = " + uploadSpeed +
                ", downloadSpeed = " + downloadSpeed +
                ", userId = " + userId +
                "}";
    }
}
